package cn.elwy.rcp.ui.table;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

import cn.elwy.rcp.ui.table.model.TableInfo;

public class TablePaneFactory {

  private TablePaneFactory() {
  }

  public static TablePane getTablePane(Composite parent, String tableId) {
    return getTablePane(parent, SWT.NONE, tableId);
  }

  public static TablePane getTablePane(Composite parent, int sytle, String tableId) {
    TableInfo tableInfo = TableConfigFactory.getTableInfo(tableId);
    return getTablePane(parent, sytle, tableInfo);
  }

  public static TablePane getTablePane(Composite parent, int sytle, TableInfo tableInfo) {
    if (tableInfo.isTable()) {
      return new TableViewerPane(parent, sytle, tableInfo);
    } else {
      return new TreeViewerPane(parent, sytle, tableInfo);
    }
  }

}